clear
import excel "\\file\UsersW$\wrr15\Home\My Documents\My Files\META-ANALYSIS (New Estimators, 2018)\I_squaredData.xlsx", sheet("Sheet1") firstrow
log using "\\file\UsersW$\wrr15\Home\My Documents\My Files\META-ANALYSIS (New Estimators, 2018)\APPENDIX5&6(Results).smcl", replace
local dvbias BIASWLSFE BIASWLSRE BIASPP BIASWAAP BIASWAAP2 BIASAK1 BIASAK2 
local dvmse MSEWLSFE MSEWLSRE MSEPP MSEWAAP MSEWAAP2 MSEAK1 MSEAK2
replace I2 = I2*100
local rhsvars1 I2 SE2 SE3 SE4 SE5 SE6 SE7 SE8 SE9
gen I2sqd = I2^2
local rhsvars2 I2 I2sqd SE2 SE3 SE4 SE5 SE6 SE7 SE8 SE9
local dummies SE2 SE3 SE4 SE5 SE6 SE7 SE8 SE9
foreach var in `dvbias' {
regress `var' `rhsvars1', vce(robust)
scalar AdjR2 = e(r2_a)
scalar list AdjR2
test `dummies'
regress `var' `rhsvars2', vce(robust)
scalar AdjR2 = e(r2_a)
scalar list AdjR2
test `dummies'
// This section calculates Estimated Marginal Impact
scalar a1 = _b[I2]
scalar a2 = _b[I2sqd]
scalar MI = a1+(2*a2*85)
scalar list MI
// This section calculated summary statistics for Bias
summ `var', detail
}
foreach var in `dvbias' {
regress `var' `rhsvars1', cluster(SimulationEnvironment)
boottest I2, reps(999999) weighttype(webb) noci 
boottest (SE2) (SE3) (SE4) (SE5) (SE6) (SE7) (SE8) (SE9), reps(999999) weighttype(webb) noci
regress `var' `rhsvars2', cluster(SimulationEnvironment)
boottest (I2), reps(999999) weighttype(webb) noci
boottest (I2sqd), reps(999999) weighttype(webb) noci
boottest (SE2) (SE3) (SE4) (SE5) (SE6) (SE7) (SE8) (SE9), reps(999999) weighttype(webb) noci
}
foreach var in `dvmse' {
regress `var' `rhsvars1', vce(robust)
scalar AdjR2 = e(r2_a)
scalar list AdjR2
test `dummies'
regress `var' `rhsvars2', vce(robust)
scalar AdjR2 = e(r2_a)
scalar list AdjR2
test `dummies'
// This section calculates Estimated Marginal Impact
scalar a1 = _b[I2]
scalar a2 = _b[I2sqd]
scalar MI = a1+(2*a2*85)
scalar list MI
// This section calculated summary statistics for Bias
summ `var', detail
}
foreach var in `dvmse' {
regress `var' `rhsvars1', cluster(SimulationEnvironment)
boottest I2, reps(999999) weighttype(webb) noci
boottest (SE2) (SE3) (SE4) (SE5) (SE6) (SE7) (SE8) (SE9), reps(999999) weighttype(webb) noci
regress `var' `rhsvars2', cluster(SimulationEnvironment)
boottest (I2), reps(999999) weighttype(webb) noci
boottest (I2sqd), reps(999999) weighttype(webb) noci
boottest (SE2) (SE3) (SE4) (SE5) (SE6) (SE7) (SE8) (SE9), reps(999999) weighttype(webb) noci
}
log close


